package org.zfes.snowier.cloud.zbss.cms.router.service.site;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.site.model.CmsSiteModel;
import org.zfes.snowier.cloud.zbss.cms.site.service.ICmsSiteModelService;
@Controller 
@RequestMapping("/cms/site/cmsSiteModel")
public class CmsSiteModelController extends BaseController {

	
	@Autowired
	private ICmsSiteModelService cmsSiteModelService;
	
	@RequiresPermissions(value="cmsSiteModel:loadCmsSiteModelDataSet",desc="站点模型列表")
    @RequestMapping(value="/loadCmsSiteModelDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsSiteModelDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsSiteModelService.loadCmsSiteModelDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsSiteModel:createCmsSiteModel",desc="站点模型添加")
    @RequestMapping(value="/createCmsSiteModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsSiteModel(CmsSiteModel cmsSiteModel){
		cmsSiteModelService.createCmsSiteModel(cmsSiteModel);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsSiteModel:loadCmsSiteModel",desc="站点模型加载")
    @RequestMapping(value="/loadCmsSiteModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsSiteModel(Long id){
		Optional<CmsSiteModel> ops = cmsSiteModelService.loadCmsSiteModelById(id);
		return ajaxQuery("cmsSiteModel",ops);
    }
	
	@RequiresPermissions(value="cmsSiteModel:updateCmsSiteModel",desc="站点模型更新")
    @RequestMapping(value="/updateCmsSiteModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsSiteModel(CmsSiteModel cmsSiteModel){
		cmsSiteModelService.updateCmsSiteModel(cmsSiteModel);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsSiteModel:deletCmsSiteModel",desc="站点模型删除")
    @RequestMapping(value="/deleteCmsSiteModel", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsSiteModel(Long id){
		cmsSiteModelService.deleteCmsSiteModel(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}